package com.maxd.respository.commodity;

import com.maxd.model.Commodity;
import com.maxd.model.CommodityExquisite;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.Repository;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

public interface CommodityExquisiteRepository extends Repository<CommodityExquisite, Long> {

    @Query(value = "select * from commodity_exquisite where id=:id",nativeQuery = true)
    CommodityExquisite selectById(@Param("id") Long id);


    @Query(value = "select * from commodity_exquisite where id=:userId",nativeQuery = true)
    List<CommodityExquisite> selectByUserId(@Param("userId") Long userId);

    @Query(value = "select * from commodity_exquisite ",
            countQuery = "select count(*) from commodity_exquisite "
            ,nativeQuery = true)
    Page<CommodityExquisite> selectCommodityExquisite(Pageable pageable);


}
